/** 
 * 
 * 
 * Test when commenting out the pure virtual function.
 * 
 * 
 */


#include "EquationSolver.h"

double func1(double x){
  return 1.0/x;
}

double dfunc1(double x){
  return -1.0/(x*x);
}

double func3(double x){
  return 2.0/x;
}

float func2(float x){
  return x*x;
}

int main(){
  double (*pf1)(double) = &func1;
  double (*pdf1)(double) = &dfunc1;
  EquationSolver<double> Solver1(100,0.01,pf1,pdf1);
  float (*pf2)(float) = &func2;
  EquationSolver<float> Solver2(50,0.0003,pf2);
  cout << "Max iter: " << Solver1.get_max_iter() << endl
       << "tol: " << Solver1.get_tol() << endl;
  Solver1.set_max_iter(233);
  Solver1.set_tol(0.0233);
  cout << "Max iter: " << Solver1.get_max_iter() << endl
       << "tol: " << Solver1.get_tol() << endl;
  float (*pf3)(float) = Solver2.get_function();
  cout << "1.2*1.2 = " << (*pf3)(1.2) << endl;
  double (*pf4)(double) = Solver1.get_function();
  double (*pdf4)(double) = Solver1.get_dfunction();
  cout << "1/2 = " << (*pf4)(2.0) << " , -1/(2*2) = " << (*pdf4)(2.0) << endl;
  double (*pf5)(double) = &func3;
  Solver1.set_function(pf5);
  pf4 = Solver1.get_function();
  cout << "2/2 = " << (*pf4)(2.0) << " , -1/(2*2) = " << (*pdf4)(2.0) << endl;
  return 0;
}
